package com.banxue.controller;
<#assign className = table.className>   
<#assign classNameLower = className?uncap_first> 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import ${basepackage}.entity.${className}Entity;
import ${basepackage}.service.${className}Service;

<#include "/java_copyright.include">
@RestController
@RequestMapping(value = "/${className}")
public class ${className}Controller {
	Logger log = LoggerFactory.getLogger(${className}Controller.class);
	
	@Autowired
	private ${className}Service ${classNameLower}Service;

	@PostMapping("/add${className}")
	public int add${className}(${className}Entity ${classNameLower}Entity) {
		return ${classNameLower}Service.add${className}(${classNameLower}Entity);
	}
	
	@GetMapping("/all${className}")
	public Object query${className}(@RequestParam(name = "pageNum", required = false, defaultValue = "1") int pageNum,
			@RequestParam(name = "pageSize", required = false, defaultValue = "10") int pageSize) {
		return ${classNameLower}Service.query${className}(pageNum, pageSize);
	}
}
